import java.io.*;
import java.util.*;

public class FileTest {
    static Scanner sc = new Scanner(System.in);

    static public void main(String [] args) throws Exception {
        System.out.println(File.pathSeparator);
        System.out.println(File.pathSeparatorChar);
        System.out.println(File.separator);
        System.out.println(File.separatorChar);

        //在临时目录里创建临时文件
        // File tmpfile = File.createTempFile("kyo", ".exe");
        //在当前目录里创建临时文件
        File tmpfile = File.createTempFile("kyo", ".exe", new File("."));
        //删除文件
        // tmpfile.delete();
        // (new File("./file.test")).delete();
        sc.nextLine();
        tmpfile.deleteOnExit();
        // tmpfile.delete();

        File file = new File("./file.test");
        if (!file.exists()) {
            file.createNewFile();
            System.out.println("读: " + file.canRead());
            System.out.println("写: " + file.canWrite());
            System.out.println("执行: " + file.canExecute());
        }
        // 返回此抽象路径名的绝对路径名形式
        System.out.println(file.getAbsoluteFile());
        // 返回此抽象路径名的绝对路径名字符串
        System.out.println(file.getAbsolutePath());
        // 返回此抽象路径名的规范形式。
        System.out.println(file.getCanonicalFile());
        // 返回此抽象路径名的规范路径
        System.out.println(file.getCanonicalPath());

        System.out.println(file.length());

        File dir = new File(".");
        System.out.println(dir.length());
        System.out.println(Arrays.toString(dir.list()));
        for (File f : dir.listFiles()) {
            System.out.println(f.getCanonicalPath());
        }

        sc.nextLine();
        System.out.printf("程序退出!\n");
    }
}
